package com.iot08.common.entity.app;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * 消息统计实体类
 * @author YourName
 * @version 1.0
 * @time 2023/8/16
 */
@Data
@Document("message_stats")
public class MessageStats implements Serializable {

        @Id
        private String id; // 直接使用 openid 或 imei 作为主键

        // 消息统计
        private Map<String, Integer> successDaily; // {"2023-08-01":5}
        private Integer successTotal;

        // 错误消息统计
        private Map<String, Integer> errorDaily; // {"2023-08-01":2}
        private Integer errorTotal;

        @Field("last_updated")
        private Date lastUpdated;
    }
